﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HammerMUD.System;
using HammerMUD.Items;
using HammerMUD.Rooms;

namespace HammerMUD.Commands
{
    public class GetCommand : Command
    {
        public GetCommand()
        {
            Name = "get";
            Help = "get <item>\n\rget <item> from <item>";
            SecurityLevel = HammerMUD.Admin.SecurityLevel.User;
        }

        public override void Do(User from, List<String> arguments)
        {
            if (arguments.Count == 1)
            {
                from.Send(Help);
                return;
            }

            if (arguments.Count == 2)
            {
                foreach (Item i in from.UserAccount.CurrentCharacter.CurrentRoom.Items)
                {
                    if(i.Name.ToLower().Equals(arguments[1].ToLower()))
                    {
                        from.UserAccount.CurrentCharacter.CurrentRoom.Items.Remove(i);
                        from.UserAccount.CurrentCharacter.Inventory.Add(i);
                        from.Send("You pick up " + i.Name);
                        RoomUtilities.SendToRoom(from, from.UserAccount.CurrentCharacter.Name + " picks up " + i.Name);
                        return;
                    }
                }

                from.Send("That object isn't here!");
            }
            else
            {
                from.Send("Not yet implemented");
                return;
            }
        }
    }
}
